Add GRPC + TLS integration tests (notably, test important security properties) - #1327
Add GRPC + TLS integration tests (notably, test important security properties)#1327matthild wants to merge 6 commits into
Conversation
|
Can one of the admins verify this patch? |
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
The Travis build failed without it, and claimed that committing generated files is necessary. https://travis-ci.org/grpc/grpc-java/jobs/103388675
|
That Travis CI build failed with an indication that Using Is there some trick to adding a new I'm running Mac OS X (El Capitan) and have protoc 3.0.0-beta1 installed (built locally). |
|
@matthild, the problem with Thanks for working through all you have. I know it is a pain to get the codegen plugin compiling because of dependencies. I'm thinking of ways that the error could have been a little more helpful. Maybe if it did |
There was a problem hiding this comment.
@nmittler, this surprises me, mainly because I thought we already had the netty_tcnative dependency in place here. It seems we are including tcnative in the binaries (via the distributions section below) but was using Jetty ALPN during gradle build. Do you remember if we did not use tcnative here before because of concerns about needing OpenSSL installed, or was it something different?
There was a problem hiding this comment.
IIRC, that was the outcome of our previous discussions ... that we wouldn't include tcnative in the automated tests due to the OpenSSL dependency. Not that configuring jetty-alpn is easier.
There was a problem hiding this comment.
The GRPC docs recommend using OpenSSL. Are there any plans to have integration tests that use this recommended configuration?
The difference is significant. For example, removing libraries.netty_tcnative from build.gradle caused the new test annotated with @Ignore to begin passing -- i.e., that test appears to fail with OpenSSL but pass with Jetty ALPN. Additionally, there is a gaping security problem that appears to occur with OpenSSL but not with Jetty ALPN.
If we run all the tests using Jetty ALPN only, what should become of the following TODO in TlsTest.java? Should I just remove it?
// TODO: Use @RunWith(Parameterized.class) to run these tests for all TLS providers.
There was a problem hiding this comment.
For now I've reverted this change (thus, the integration tests run with Jetty ALPN only, not with OpenSSL), although personally I think there really ought to be integration tests that use the recommended configuration.
There was a problem hiding this comment.
Just for starters, I do know of other tests that are using OpenSSL: the interop-testing unit tests are run internally at google using tcnative (I just confirmed). Tcnative is also used for the actual interop testing, both internally (I just confirmed) and externally (granted, those are a different sort of test).
I think the original plan was to use tcnative on Travis (because otherwise, why do a99e977?), but still allow small-time contributors to use Jetty ALPN. I know we hit a snag with OkHttp, because it only supports Jetty ALPN on OpenJDK and it couldn't talk to Netty on Linux because OpenSSL is generally too old to include ALPN. That's a different problem than on OS X and Windows, because on those platforms OpenSSL is generally not available and the code falls back to Jetty ALPN.
So for Linux we needed to check whether OpenSSL is new enough. But that was broken. I think once it was fixed we simply failed to follow through. Time to follow through; I've sent out #1332.
There was a problem hiding this comment.
I just filed #1330 for what I expect to be the same problem as here.
Thus, tests run using Jetty ALPN only, not using OpenSSL.
|
@matthild LGTM. I'll merge it and then close the PR |
This pull request adds end-to-end tests of the following basic functionality:
GrpcSslContextscan successfully communicate with each other. (This last test fails -- any idea why? For now I've annotated it@Ignoreto avoid breaking the build.)These tests work by having an actual GRPC client talk through the operating system's network stack to an actual GRPC server listening on a port, and thus mimic how GRPC will behave in real-world applications.
(I have also drafted tests of some other important security properties, but suggest adding them later via a separate pull request, once these initial tests are in place. The additional tests will be easier to add in a sensible way if some organization of the test certificates directory happens first.)